package com.zxgllhh.domain;

/**
 * 
 * @author Zhao,XingGuo
 *
 */
public class Dragon {

	public Dragon(String son) {
		this.son = son;
	}

	private String son;

	public String getSon() {
		return son;
	}

	public void setSon(String son) {
		this.son = son;
	}
	
	//WebNewsInfo
	public String getTableClassName(){
		String sa[] = getSon().split("[_]");
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < sa.length; i++) {
			String s = this.firstUpper(sa[i]);
			sb.append(s);
		}
		return sb.toString();
	}
	
	//webNewsInfo
	public String getTableObjectName(){
		String sa[] = getSon().split("[_]");
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < sa.length; i++) {
			String s = new String();
			if (i == 0) {
				s = sa[i].toLowerCase();
			} else {
				s = this.firstUpper(sa[i]);
			}
			sb.append(s);
		}
		return sb.toString();
	}
	
	public String getCulumnClassName(){
		return this.firstUpper(getSon().toLowerCase());
	}
	
	//webNewsInfo
	public String getCulumnObjectName(){
		return this.getSon().toLowerCase();
	}
	


	public String firstUpper(String s) {
		char ch[];
		ch = s.toLowerCase().toCharArray();
		ch[0] = (char) (ch[0] - 32);
		String result = new String(ch);
		return result;
	}
	
	public static void main(String[] args) {
		System.out.println(new Dragon("WEB_NEWS_INFO").getTableClassName());
		System.out.println(new Dragon("WEB_NEWS_INFO").getTableObjectName());
		System.out.println(new Dragon("WEB_NEWS_INFO").getCulumnClassName());
		System.out.println(new Dragon("WEB_NEWS_INFO").getCulumnObjectName());
	}
}
